    @extends('common.admin-master')

    @section('html-body')
    <div class="content">
        
        <div class="header">
            <h3 class="page-title">编辑创业者</h3>
        </div>
        
        <div class="container-fluid">
            <div class="row-fluid">


<div class="well">
    <ul class="nav nav-tabs">
        <li class="active"><a href="#home" data-toggle="tab">创业者信息编辑</a></li>
    </ul>
    <div id="myTabContent" class="tab-content">
        <div class="tab-pane active in" id="home">
            <label>头像</label>
            <em class="pro-name"></em><a class="logo" href="javascript:void(0);" id="inputImage"><img
                        id="project_logo_url" src="{{route('Api.Images.Show')}}"
                        title="点击上传logo" width="100" height="100" /></a>
            <input type="hidden" id="photo_id" value="{{\Illuminate\Support\Facades\Session::get('ImageId') == ''?0:\Illuminate\Support\Facades\Session::get('ImageId')}}" />
            <em class="msg"></em><em class="c-u-d">请上传 256 x 256 以上像素的图片，</em><em class="c-u-d">格式为JPG、JPEG、PNG，小于5MB</em>
            <label>姓名</label>
            <input type="text" name="realname" value="{{$creater->userInfo->realname}}" class="input-xlarge">

            <label>所在地</label>
            <input name="province" type="text" class="input-xlarge" value="{{$creater->userInfo->province}}"/> -
            <input name="city" type="text" class="input-xlarge" value="{{$creater->userInfo->city}}"/>

            <label>微信</label>
            <input type="text" name="wechat" value="{{$creater->userInfo->wechat}}" class="input-xlarge">
            <label>微博</label>
            <input type="text" name="weibo"  value="{{$creater->userInfo->weibo}}" class="input-xlarge">
            <label>脉脉</label>
            <input type="text" name="maimai" value="{{$creater->userInfo->maimai}}" class="input-xlarge">
            <label>毕业院校</label>
            <input type="text" name="edu_school" value="{{$creater->userInfo->edu_school}}" class="input-xlarge">
            <label>职位</label>
            <input type="text" name="position" value="{{$creater->userInfo->position}}" class="input-xlarge">
            <label>个人简介</label>
            <textarea name="user_desc" rows="5" class="input-xlarge">{{$creater->userInfo->user_desc}}</textarea>
            <input type="hidden" name="user_id" value="{{$creater->id}}">
        </div>

        <div class="btn-toolbar">
            <button class="btn btn-primary save"><i class="icon-save"></i> 保存</button>
            <a href="#myModal" data-toggle="modal" class="btn">取消</a>
            <div class="btn-group">
            </div>
        </div>

    </div>

</div>
            </div>
        </div>
    </div>
    <script>
        var editUserInfoByAdmin  = "{{route('Api.Admin.editUserInfoByAdmin')}}";
        var delUserInfoByAdmin   = "{{route('Api.Admin.delUserInfoByAdmin')}}";
        var editCreaterPage      = "{{route('Admin.Users.editCreaterPage' ,['id'=>$creater->id])}}";
        var Home                 = "{{route('Admin')}}";
    </script>
    <script src="{{url('/js/admin/creater.js')}}"></script>
    <script>
        init();
    </script>
    <script type="text/javascript">
        $("[rel=tooltip]").tooltip();

        $('.demo-cancel-click').click(function(){return false;});

        /** tab 选项卡 */
        $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {

            var activeTab = $(e.target).text();

            var previousTab = $(e.relatedTarget).text();
            $(".active-tab span").html(activeTab);
            $(".previous-tab span").html(previousTab);
        });

        /** 头像上传 */
        var uploader = new plupload.Uploader({
            runtimes: 'html5,flash,silverlight,html4',
            browse_button: 'inputImage',
            url: '{{ url('api/upload/image')  }}',

            chunk_size: '2mb',
            filters: {
                max_file_size: '10mb',
                mime_types: [
                    {title: "Image files", extensions: "jpg,gif,png"}
                ],
                prevent_duplicates: false
            },
            multi_selection: true,
            unique_names: true,

            flash_swf_url: '{{ url('vendor/plupload-2.1.2/Moxie.swf') }}',
            silverlight_xap_url: '{{ url('vendor/plupload-2.1.2/Moxie.xap') }}',

            file_data_name: 'photo',
            headers: {
                Accept: 'application/json'
            },

            multipart_params: {
                _token: '{{ csrf_token() }}'
            },

            init: {
                PostInit: function () {
                },

                FilesAdded: function (up, files) {
                    up.start();
                },

                BeforeUpload: function (up, file) {
                    up.settings.multipart_params.file_name = file.name;
                },

                UploadProgress: function (up, file) {
                    $('.msg').html('上传中...');
                },

                Error: function (up, err) {
                    var responseObj = '', responseMessage = '';
                    try {
                        responseObj = $.parseJSON(err.response);
                        responseMessage = responseObj.message;
                    } catch ($e) {

                    }

                    noty({
                        type: 'error',
                        text: err.message + ' ' + responseMessage,
                        callback: {
                            afterClose: function () {
                                $('#inputImage').show();
                                $('#inputImageProgress').hide();
                            }
                        }
                    });
                },

                FileUploaded: function (up, file, info) {
                    var responseObj = '', responseMessage = '';
                    try {
                        responseObj = $.parseJSON(info.response);
                        responseMessage = responseObj.message;
                    } catch ($e) {

                    }

                    var $inputImage = $('.msg');
                    $inputImage.html('上传成功！');
                    $inputImage.show();

                    var imageUrl = '', imageId = 0;
                    if (responseObj && responseObj.data) {
                        var d = new Date();
                        imageUrl = "{{route('Api.Images.Show')}}?"+d.getTime();
                        imageId = responseObj.data.id;
                    }
                    $('#project_logo_url').attr('src', imageUrl);
                    if(imageId !== null){
                        $('#photo_id').val(imageId);
                    }else{
                        $('#photo_id').val('0');
                    }
                }
            }
        });
        uploader.init();
    </script>
    
    @endsection


